/*
 * main.cpp
 *
 *  Created on: Jan 19, 2010
 *      Author: nrqm
 *
 * This example program will configure the radio as a receiver and wait for a packet.
 *  When the packet is received the radio will assert the IRQ pin.  The driver will
 *  handle the interrupt and call the radio_rxhandler function defined below in this
 *  file.  If you don't call the Radio_Receive function at some point, then the radio
 *  will stop receiving after it queues up three packets.
 *
 * This example has the radio's Vcc pin connected to the Seeeduino's pin 48.  This
 *  allows the radio's power to be cycled programatically.  Cycling the radio is not
 *  strictly necessary, but it can be useful if you run into driver bugs.  The complete
 *  pin mapping is as follows:
 *
 * Radio		Seeeduino
 *  Vcc				48
 *   CE				8
 *  CSN				7
 *  SCK				52
 * MOSI				51
 * MISO				50
 *  IRQ				2
 *  GND				GND
 *
 * If you don't like the CE and CSN pins way off on the other side of the board then
 *  you can change them to another digital I/O port (they're defined at the top of
 *  radio.cpp).  The IRQ pin can be moved to another interrupt pin (see online docs
 *  for attachInterrupt function; also the interrupt number is hardcoded in the driver
 *  because I'm irresponsible).
 */

#include "components/RadioReceiver.h"

// An extensible packet structure for transmitting data over the radio.  See packet.h for
// more information.
/*
extern "C" void __cxa_pure_virtual(){};


int main()
{
	// Initialize the Arduino stuff
	init();

	// Test the led
	pinMode(13, OUTPUT);
	digitalWrite( 13, HIGH );
	delay( 500 );
	digitalWrite( 13, LOW );

	//setup
	Serial.begin( BAUD_RATE );
	Serial.println( "setting up radio" );
	setupRadioReceiver();
	Serial.println( "radio setup" );

	//loop so you don't get lost on the board
	while( true );

	return 0;
}

/* This function is called by the radio driver whenever the radio receives a packet.
 */ /*
void handleCommand( int messageId )
{
	Serial.println( "message received: " );
	Serial.println( messageId );
}
*/
